﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HammerMUD.Areas;
using HammerMUD.System;
using HammerMUD.Characters;

namespace HammerMUD.Rooms
{
    public class RoomUtilities
    {
        public static Room FindRoom(Int64 roomNumber)
        {
            Room theRoom = HammerMUD.System.HammerMUD.EmptyRoom;
            foreach (Area a in HammerMUD.System.HammerMUD.Areas)
            {
                foreach (Room r in a.Rooms)
                {
                    if (r.RoomNumber.Equals(roomNumber))
                    {
                        theRoom = r;
                        break;
                    }
                }
            }

            return theRoom;
        }

        internal static void SendToRoom(User from, string message)
        {
            foreach (Character c in from.UserAccount.CurrentCharacter.CurrentRoom.Characters)
            {
                if (c.Equals(from.UserAccount.CurrentCharacter))
                {
                    continue;
                }

                c.Send(message);
            }
        }
    }
}
